using Microsoft.Data.Sqlite;
using SqlSugar;

namespace JamesFan.FetchAreaCodes.Repository.Sqlite;

internal class SqliteRepository : AbstractRepository {
    public SqliteRepository(string filePath) : base(GetConfig(filePath)) { }

    private static ConnectionConfig GetConfig(string filePath) {
        SqliteConnectionStringBuilder connBuilder = new() {
            DataSource = filePath,
        };

        return new ConnectionConfig {
            DbType = DbType.Sqlite,
            ConnectionString = connBuilder.ToString(),
        };
    }
}
